package com.yonyou.crm.bpub.topbar.service;

import java.util.*;

import org.springframework.stereotype.Service;

import com.yonyou.crm.bpub.topbar.entity.*;
import com.yonyou.crm.common.filter.entity.AppFilterTypeConstant;
import com.yonyou.crm.common.search.entity.AppSearchPlanEnum;
import com.yonyou.crm.common.sort.entity.AppSortPlanEnum;

@Service
public class ContactTopbar extends BaseTopbar {
	
	@Override
	public PlanVO getPresetOptions(){
		PlanVO presetOption = new PlanVO();
		presetOption.setTitle("预置选择");
		
		List<DataItemVO> data = new ArrayList<>();
		DataItemVO item;
		
		item = new DataItemVO(String.valueOf(AppSearchPlanEnum.ALL.getValue()), AppSearchPlanEnum.ALL.getName());
		data.add(item);
		
		item = new DataItemVO(String.valueOf(AppSearchPlanEnum.OWNER.getValue()), AppSearchPlanEnum.OWNER.getName());
		data.add(item);
		
		item = new DataItemVO(String.valueOf(AppSearchPlanEnum.REL.getValue()), AppSearchPlanEnum.REL.getName());
		data.add(item);
		
		item = new DataItemVO(String.valueOf(AppSearchPlanEnum.FOLLOW.getValue()), AppSearchPlanEnum.FOLLOW.getName());
		data.add(item);
		
		item = new DataItemVO(String.valueOf(AppSearchPlanEnum.BIRTHMONTH.getValue()), AppSearchPlanEnum.BIRTHMONTH.getName());
		data.add(item);
		
		item = new DataItemVO(String.valueOf(AppSearchPlanEnum.VIEW.getValue()), AppSearchPlanEnum.VIEW.getName());
		data.add(item);

		presetOption.setData(data);
		
		return presetOption;
	};
	
	@Override
	public String getSearchPlaceholder(){
		String searchText = "搜索联系人名称";
		return searchText;
	}
	
	@Override
	public PlanVO getSortData(){
		PlanVO sortData = new PlanVO();
		sortData.setTitle("排序");
		
		List<DataItemVO> data = new ArrayList<>();
		DataItemVO item;
		
		item = new DataItemVO(String.valueOf(AppSortPlanEnum.NAME.getValue()), AppSortPlanEnum.NAME.getName());
		data.add(item);
		
		item = new DataItemVO(String.valueOf(AppSortPlanEnum.CREATETIME.getValue()), AppSortPlanEnum.CREATETIME.getName());
		data.add(item);
		
		item = new DataItemVO(String.valueOf(AppSortPlanEnum.FOLLOWUPTIME.getValue()), AppSortPlanEnum.FOLLOWUPTIME.getName());
		data.add(item);

		sortData.setData(data);
		return sortData;
	};
	
	@Override
	public List<SelectDataVO> getSelectData(){
		List<SelectDataVO> selectData = new ArrayList<SelectDataVO>();
		SelectDataVO select;
		List<DataItemVO> data;
		
		select = new SelectDataVO();
		select.setKey("mainContact");
		select.setType(AppFilterTypeConstant.Radio);
		select.setTitle("主联系人");
		data = getEnumList("contact_main");
		select.setData(data);
		selectData.add(select);
		
		select = new SelectDataVO();
		select.setKey("roles");
		select.setType(AppFilterTypeConstant.Multiple);
		select.setTitle("角色");
		data = getEnumList("contact_role");
		select.setData(data);
		selectData.add(select);
		
		select = new SelectDataVO();
		select.setKey("attitudes");
		select.setType(AppFilterTypeConstant.Multiple);
		select.setTitle("态度");
		data = getEnumList("contact_attitude");
		select.setData(data);
		selectData.add(select);

		return selectData;
	}

}
